package include2;

import java.util.Random;

// 西游记
public class MonkeyStory {
	private Master master;
	private Apprentice[] apps;
	private Monster[] mons;
	
	public MonkeyStory() {
		super();
	}

	public MonkeyStory(Master master, Apprentice[] apps, Monster[] mons) {
		super();
		this.master = master;
		this.apps = apps;
		this.mons = mons;
	}

	public Master getMaster() {
		return master;
	}

	public void setMaster(Master master) {
		this.master = master;
	}

	public Apprentice[] getApps() {
		return apps;
	}

	public void setApps(Apprentice[] apps) {
		this.apps = apps;
	}

	public Monster[] getMons() {
		return mons;
	}

	public void setMons(Monster[] mons) {
		this.mons = mons;
	}
	
	//西天取经故事开始
	public void storyStart() {
		Random rand = new Random();
		System.out.println("西游记开始了....");
		// 三个妖精，三个徒弟，随机产生妖怪和徒弟
		int yindex = rand.nextInt(3);
		int tindex = rand.nextInt(3); // 0-2
		// 妖怪先抓师父
		mons[yindex].catchMaster(master);
		// 徒弟
		apps[tindex].beatMonster(mons[yindex]);
		
		if (apps[tindex].getName().equals("孙悟空")) {
			master.readHoopspell(apps[tindex]);
		}
	}
}














